const Pinglun = require('../models/pinglun.model');

//新
exports.create = function(req, res, next) {
    const pinglun = new Pinglun(req.body);
    pinglun.save().then(data => {
        res.json(data)
    })
};

// //查
// exports.list = function(req, res, next) {
//     var page = req.body.page ? req.body.page : 1;
//     var rows = req.body.rows ? req.body.rows : 5;
//     var queryCondition = {};
//     if (req.body.name && req.body.name.trim().length > 0) {
//         name = req.body.name;
//         queryCondition = {
//             name: new RegExp(name, 'i')
//         };
//     }
//     Pinglun.paginate(queryCondition, { page: +page, limit: +rows }, function(err, result) {
//         result.rows = result.docs;
//         delete result.docs;
//         res.json(result);
//     });
// }